package com.zzb.framework.param.dao;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zzb.framework.param.dao.mapper.SysParamMapper;
import com.zzb.framework.param.entity.SysParam;
import com.zzb.framework.common.BaseDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * 系统配置表 Dao接口
 */
@Repository
public class SysParamDAO extends BaseDAO<SysParam> {

    @Autowired
    private SysParamMapper sysParamMapper;
    @Override
    public SysParamMapper getMapper() { return sysParamMapper; }

    public SysParam findTopByParamName(String paramName){
        return getMapper().selectList(new EntityWrapper<SysParam>()
                .eq("param_name", paramName)
                .orderBy("create_time", false)
                .last("limit 1")).stream().findFirst().orElse(null);
    }
}
